package com.sgb.kjwl.view.ui.activity.chat;

import android.content.Context;
import android.content.Intent;
import android.view.View;

import androidx.databinding.DataBindingUtil;
import androidx.fragment.app.Fragment;

import com.sgb.kjwl.R;
import com.sgb.kjwl.databinding.AtContactBookBinding;
import com.swgk.core.base.AppActivity;
import com.im.immodel.IMUtils;

/*
 * 新通讯录界面
 * LiWei 2021/10/9
 * */
public class ContactBookActivity extends AppActivity {

    private AtContactBookBinding binding;


    public static void start(Context context) {
        Intent intent = new Intent();
        intent.setClass(context, ContactBookActivity.class);
        context.startActivity(intent);
    }

    @Override
    protected void initView() {
        binding = DataBindingUtil.setContentView(ContactBookActivity.this, R.layout.at_contact_book);
        binding.include.titleView.setText("通讯录");
        binding.include.ivBack.setOnClickListener(this);

        Fragment fragment = IMUtils.getInstance().onBackContactBook(true);
        if (fragment != null) {
            getSupportFragmentManager()
                    .beginTransaction()
                    .add(R.id.fragment_container, fragment)
                    .commitAllowingStateLoss();
        }
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.iv_back:
                finish();
                break;
        }
    }
}
